package starter.kit.rx.app.feature.film;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import starter.kit.rx.app.R;
import starter.kit.rx.app.model.bean.filmdetail.FilmPeople;
import starter.kit.rx.app.util.DisplayImgUtis;
import support.ui.adapters.EasyViewHolder;

/**
 * ============================================================
 * 版权： xx 版权所有（c）2016
 * <p>
 * 作者：Loofer
 * 版本：1.0
 * 创建日期 ：2016/10/25 10:07.
 * 描述：
 * <p>
 * 注:如果您修改了本类请填写以下内容作为记录，如非本人操作劳烦通知，谢谢！！！
 * Modified Date Modify Content:
 * <p>
 * ==========================================================
 */
public class CastViewHolder extends EasyViewHolder<FilmPeople> {


    @BindView(R.id.iv_avatar)
    ImageView mIvAvatar;
    @BindView(R.id.tv_name_chinease)
    TextView mTvNameChinease;
    @BindView(R.id.tv_name_english)
    TextView mTvNameEnglish;
    private Context mContext;

    public CastViewHolder(Context context, ViewGroup parent) {
        super(context, parent, R.layout.item_film_people);
        ButterKnife.bind(this, itemView);
        this.mContext = context;
    }

    @Override
    public void bindTo(int position, FilmPeople filmPeople) {
        DisplayImgUtis.getInstance().display(mContext, filmPeople.getAvatars().getLarge(), mIvAvatar);
        mTvNameChinease.setText(filmPeople.getName());
        if (filmPeople.getType() == 1) {
            mTvNameEnglish.setText("［导演］");
        } else {
            mTvNameEnglish.setText("［演员］");
        }
    }


}
